<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Examples &middot; Bootstrap Table</title>
    <meta name="author" content="zhixin">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="../assets/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../src/bootstrap-table.css">
    <link rel="stylesheet" href="docs.css">
    <link rel="stylesheet" href="//wenzhixin.net.cn/css/fork.css">
    <!--[if lt IE 9]>
    <script src="//wenzhixin.net.cn/js/html5shiv.js"></script>
    <script src="//wenzhixin.net.cn/js/respond.min.js"></script>
    <![endif]-->

    <script src="../assets/jquery.min.js"></script>
    <script src="../assets/bootstrap/js/bootstrap.min.js"></script>
    <script src="../docs/examples.js"></script>
    <script src="../src/bootstrap-table.js"></script>
    <script src="docs.js"></script>
    <script src="//wenzhixin.net.cn/js/analytics.js"></script>
</head>
<body>
<a class="sr-only" href="#content">Skip to main content</a>
<header class="navbar navbar-inverse navbar-fixed-top bs-docs-nav">
    <div class="container">
        <div class="navbar-header">
            <a class="navbar-brand" href="index.html">
                Bootstrap Table
            </a>
        </div>
        <nav class="collapse navbar-collapse bs-navbar-collapse" role="navigation">
            <ul class="nav navbar-nav">
                <li>
                    <a href="getting-started.html">Getting started</a>
                </li>
                <li>
                    <a href="documentation.html">Documentation</a>
                </li>
                <li class="active">
                    <a href="examples.html">Examples</a>
                </li>
            </ul>
        </nav>
    </div>
</header>
<div class="bs-header" id="content">
    <div class="container">
        <h1>Examples</h1>
        <p>The examples of bootstrap table.</p>
    </div>
</div>
<div class="container">
    <div class="row">
        <div class="col-md-3">
            <div class="bs-sidebar" role="complementary">
                <ul class="nav bs-sidenav">
                    <li><a href="#basic-table">Basic Table</a></li>
                    <li><a href="#transform-table">Transform Table</a></li>
                    <li><a href="#classes-table">Table Style</a></li>
                    <li><a href="#sort-table">Sort Table</a></li>
                    <li><a href="#custom-sort-table">Custom Sort Table</a></li>
                    <li><a href="#radio-table">Radio Table</a></li>
                    <li><a href="#checkbox-table">Checkbox Table</a></li>
                    <li><a href="#pagination-table">Pagination Table</a></li>
                </ul>
            </div>
        </div>
        <div class="col-md-9" role="main">
            <div>
                <div class="page-header">
                    <h1 id="basic-table">Basic Table</h1>
                </div>
                <div class="bs-example">
                    <table data-toggle="table" data-url="data1.json" data-height="246">
                        <thead>
                            <tr>
                                <th data-field="id">Item ID</th>
                                <th data-field="name">Item Name</th>
                                <th data-field="price">Item Price</th>
                            </tr>
                        </thead>
                    </table>
                </div>
                <div class="highlight"><pre><code class="language-html"></code></pre></div>
            </div>

            <div>
                <div class="page-header">
                    <h1 id="transform-table">Transform Table</h1>
                </div>
                <div class="bs-example">
                    <div class="btn-group btn-default">
                        <button class="btn btn-success" id="transform">Transform</button>
                        <button class="btn btn-danger" id="destroy">Destroy</button>
                    </div>
                    <table id="table-transform" data-url="data1.json" data-height="246">
                        <thead>
                            <tr>
                                <th data-field="id">Item ID</th>
                                <th data-field="name">Item Name</th>
                                <th data-field="price">Item Price</th>
                            </tr>
                        </thead>
                    </table>
                    <script>
                        $(function() {
                            $('#transform').click(function() {
                                $('#table-transform').bootstrapTable();
                            });
                            $('#destroy').click(function() {
                                $('#table-transform').bootstrapTable('destroy');
                            });
                        });
                    </script>
                </div>
                <div class="highlight"><pre><code class="language-html"></code></pre></div>
            </div>

            <div>
                <div class="page-header">
                    <h1 id="classes-table">Table Style</h1>
                </div>
                <div class="bs-example">
                    <div>
                        <label><input id="hover" type="checkbox" checked> hover</label>
                        <label><input id="striped" type="checkbox"> striped</label>
                    </div>
                    <table id="table-style" data-toggle="table" data-url="data1.json" data-height="246">
                        <thead>
                        <tr>
                            <th data-field="id">Item ID</th>
                            <th data-field="name">Item Name</th>
                            <th data-field="price">Item Price</th>
                        </tr>
                        </thead>
                    </table>
                    <script>
                        $(function() {
                            $('#hover, #striped').click(function() {
                                var classes = 'table';

                                if ($('#hover').prop('checked')) {
                                    classes = 'table table-hover';
                                }
                                $('#table-style').bootstrapTable('destroy')
                                    .bootstrapTable({
                                        classes: classes,
                                        striped: $('#striped').prop('checked')
                                    });
                            });
                        });
                    </script>
                </div>
                <div class="highlight"><pre><code class="language-html"></code></pre></div>
            </div>

            <div>
                <div class="page-header">
                    <h1 id="sort-table">Sort Table</h1>
                </div>
                <div class="bs-example">
                    <table data-toggle="table" data-url="data1.json" data-height="246" data-sort-name="name" data-sort-order="desc">
                        <thead>
                            <tr>
                                <th data-field="id" data-align="right" data-sortable="true">Item ID</th>
                                <th data-field="name" data-align="center" data-sortable="true">Item Name</th>
                                <th data-field="price" data-sortable="true" data-sortable="true">Item Price</th>
                            </tr>
                        </thead>
                    </table>
                </div>
                <div class="highlight"><pre><code class="language-html"></code></pre></div>
            </div>

            <div>
                <div class="page-header">
                    <h1 id="custom-sort-table">Custom Sort Table</h1>
                </div>
                <div class="bs-example">
                    <table id="table-custom-sort" data-toggle="table" data-url="data1.json" data-height="246" data-sort-name="price" data-sort-order="desc">
                        <thead>
                        <tr>
                            <th data-field="id" data-align="right" data-sortable="true">Item ID</th>
                            <th data-field="name" data-align="center" data-sortable="true">Item Name</th>
                            <th data-field="price" data-sortable="true" data-sortable="true" data-sorter="priceSorter">Item Price</th>
                        </tr>
                        </thead>
                    </table>
                    <script>
                        function priceSorter(a, b) {
                            a = +a.substring(1); // remove $
                            b = +b.substring(1);
                            if (a > b) return 1;
                            if (a < b) return -1;
                            return 0;
                        }
                    </script>
                </div>
                <div class="highlight"><pre><code class="language-html"></code></pre></div>
            </div>

            <div>
                <div class="page-header">
                    <h1 id="radio-table">Radio Table</h1>
                </div>
                <div class="bs-example">
                    <table data-toggle="table" data-url="data1.json" data-height="246">
                        <thead>
                            <tr>
                                <th data-field="state" data-radio="true"></th>
                                <th data-field="id" data-align="right">Item ID</th>
                                <th data-field="name" data-align="center">Item Name</th>
                                <th data-field="price" data-align="left">Item Price</th>
                            </tr>
                        </thead>
                    </table>
                </div>
                <div class="highlight"><pre><code class="language-html"></code></pre></div>
            </div>
            <div>
                <div class="page-header">
                    <h1 id="checkbox-table">Checkbox Table</h1>
                </div>
                <div class="bs-example">
                    <table data-toggle="table" data-url="data1.json" data-height="246">
                        <thead>
                            <tr>
                                <th data-field="state" data-checkbox="true"></th>
                                <th data-field="id" data-align="right">Item ID</th>
                                <th data-field="name" data-align="center">Item Name</th>
                                <th data-field="price" data-align="">Item Price</th>
                            </tr>
                        </thead>
                    </table>
                </div>
                <div class="highlight"><pre><code class="language-html"></code></pre></div>
            </div>

            <div>
                <div class="page-header">
                    <h1 id="pagination-table">Pagination Table</h1>
                </div>
                <div class="bs-example">
                    <table data-toggle="table" data-url="data2.json" data-height="246" data-pagination="true">
                        <thead>
                            <tr>
                                <th data-field="state" data-checkbox="true"></th>
                                <th data-field="id" data-align="right">Item ID</th>
                                <th data-field="name" data-align="center">Item Name</th>
                                <th data-field="price" data-align="">Item Price</th>
                            </tr>
                        </thead>
                    </table>
                </div>
                <div class="highlight"><pre><code class="language-html"></code></pre></div>
            </div>

            <hr>
            <a href="https://github.com/wenzhixin/bootstrap-table/blob/master/docs/docs.js">More examples use JavaScript</a>
        </div>
    </div>
</div>

<a href="https://github.com/wenzhixin/bootstrap-table" class="fork_me"></a>

<footer class="bs-footer" role="contentinfo">
    <div class="container">
        <p>Copyright © 2012-2014, Bootstrap Table is licensed under the The MIT License. Coded by wenzhixin. </p>
        <ul class="footer-links">
            <li>Currently: v1.0.1</li>
            <li class="muted">·</li>
            <li><a href="http://wenzhixin.net.cn">My website</a></li>
            <li class="muted">·</li>
            <li><a href="http://repos.wenzhixin.net.cn">My repos</a></li>
            <li class="muted">·</li>
            <li><a href="https://github.com/wenzhixin">Github (@wenzhixin)</a></li>
            <li class="muted">·</li>
            <li><a href="https://github.com/wenzhixin/bootstrap-table/issues?state=open">Issues</a></li>
            <li class="muted">·</li>
            <li><a href="mailto:wenzhixin2010@gmail.com">Email</a></li>
        </ul>
    </div>
</footer>
</body>
</html>
